package org.mm.repository;

import org.mm.model.Patient;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 * PatientRepository
 *
 * @author Marco Traversari
 * @version $Revision: $ $Date: $ $Author: $
 */
public interface PatientRepository extends PagingAndSortingRepository<Patient, Long> {
	
	@Query("select p from Patient p join fetch p.user1 join fetch p.user2 join fetch p.user3 where p.user1.userId = ?1")
	public Patient findByParentUserId(Long parentUserId) throws Exception;
}
